import 'package:flutter/material.dart';
class ShowDialog{
  static void showError(BuildContext context){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
            side: BorderSide(color: Colors.red, width: 3),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '错误',
            style: TextStyle(
              color: Colors.black,
              fontSize: 24.0,
            ),
          ),
          content: Text('添加失败'),
          actions: <Widget>[
            TextButton(
              child: Text('确定', style: TextStyle(color: Colors.black)),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
  static void showErrorAndDetail(BuildContext context,String message){
      showDialog(
        context: context,
        builder: (BuildContext context) {
          return AlertDialog(
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20),
              side: BorderSide(color: Colors.red, width: 3),
            ),
            backgroundColor: Colors.white,
            title: Text(
              '错误',
              style: TextStyle(
                color: Colors.black,
                fontSize: 24.0,
              ),
            ),
            content: Text(message),
            actions: <Widget>[
              TextButton(
                child: Text(
                  '确定',
                  style: TextStyle(color: Colors.black),
                ),
                onPressed: () {
                  Navigator.of(context).pop();
                },
              ),
            ],
          );
        },
      );
  }
  static void showCorrect(BuildContext context){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
            side: BorderSide(color: Colors.tealAccent, width: 3),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '成功',
            style: TextStyle(color: Colors.black),
          ),
          content: Text(
            '添加成功',
            textAlign: TextAlign.center,
          ),
          actions: <Widget>[
            TextButton(
              child: Text('确定', style: TextStyle(color: Colors.black)),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
  static void showCorrectAndDetail(BuildContext context,String message){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
            side: BorderSide(color: Colors.tealAccent, width: 3),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '成功',
            style: TextStyle(
              color: Colors.black,
              fontSize: 24.0,
            ),
          ),
          content: Text(message),
          actions: <Widget>[
            TextButton(
              child: Text(
                '确定',
                style: TextStyle(color: Colors.black),
              ),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
}

